package com.wyp.didishige.activity.me;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

import com.wyp.didishige.R;
import com.wyp.didishige.activity.BaseActivity;

public class AboutActivity extends BaseActivity {

    private TextView mVersion;
    private View mTopLay;
    Animation mTopIn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        init();
    }

    @Override
    protected void initWidget() {
        super.initWidget();
        mTopLay = findViewById(R.id.mTopLay);
        mVersion= (TextView) findViewById(R.id.mVersion);
    }

    @Override
    protected void initParamter() {
        super.initParamter();
        actionBar=getSupportActionBar();
        actionBar.setTitle(R.string.app_name);
        actionBar.setDisplayHomeAsUpEnabled(true);
        mTopIn = AnimationUtils.loadAnimation(this,R.anim.hr_dialog_top_enter_anim);
    }

    @Override
    protected void initWidgetListener() {
        super.initWidgetListener();
        mTopIn.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                mTopLay.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });

    }

    @Override
    protected void initWidgetState() {
        super.initWidgetState();
        PackageManager packageManager=getPackageManager();

        try {
            PackageInfo packageInfo=packageManager.getPackageInfo(this.getPackageName(),0);
            mVersion.setText(packageInfo.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        mTopLay.startAnimation(mTopIn);
    }
}
